home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 65.zip / BS1 part 65 / Math Visin v2.1 disk 1.adf / Arexx.WB / SayCHRS < prev    next >
Text File  |  1992-02-12  |  2KB  |  68 lines

  1. /* sayCHRS  show the CHRS hunk from a MathVision project 15-May-90
  2.  
  3. Utility for viewing the CHRS (formula) hunks in IFF ILBM files as
  4. stored by MathVision.
  5.  
  6. ----------------------------------------------------------------------- */
  7. PARSE ARG filename    /* what filename? */
  8.  
  9. if (length(Filename)<2) THEN
  10. DO
  11.   SAY "This utility displays the formulas from MathVision projects."
  12.   SAY ""
  13.   SAY "From Workbench:"
  14.   SAY "    1. Click once on SayCHRS,"
  15.   SAY "    2. Hold down <SHIFT>,"
  16.   SAY "    3. And double-click on the desired picture."
  17.   SAY ""
  18.   SAY "From CLI:"
  19.   SAY "    RX SAYCHRS filename"
  20.   SAY ""
  21.   OPTIONS PROMPT "Press <RETURN> to Exit"
  22.   pull ans
  23.   EXIT
  24. END
  25.  
  26. IF( OPEN( fh, filename, 'Read')==0) THEN
  27. DO
  28.   OPTIONS PROMPT "Cannot open file "filename". Press <RETURN>"
  29.   pull answer
  30.   EXIT
  31. END
  32. Seeker = 0
  33.  
  34. IsForm = READCH( fh, 4); Seeker = Seeker+4        /* is right file? */
  35. if (IsForm~='FORM') THEN EXIT
  36. formsize = c2d(READCH( fh, 4)); Seeker = Seeker+4
  37. IsILBM = READCH( fh, 4 ); Seeker = Seeker+4
  38. if (IsILBM~='ILBM') THEN EXIT
  39.  
  40. DO WHILE ( ~EOF(fh) & (Seeker < Formsize) )
  41.   PropertyType = READCH( fh, 4 ) ; Seeker = Seeker+4
  42.   PropertyLength = c2d(READCH( fh, 4 )); Seeker = Seeker+4
  43.   if (PropertyLength//2 ~= 0) THEN PropertyLength = PropertyLength+1
  44.   IF (PropertyType~='CHRS') THEN        /* skip unknowns */
  45.   DO
  46.     Seeker = Seeker + PropertyLength
  47.     ok = Seek( fh, Seeker, 'B' )    /* Seek on 'Current' not work */
  48.   END
  49.   ELSE
  50.   DO
  51.     hunk = READCH( fh, PropertyLength )        /* display CHRS hunk */
  52.     i = 1; j = INDEX( hunk, d2c(10) )
  53.     Do while( j ~= 0)
  54.       say substr( hunk, i, j-i )
  55.       i = j+1
  56.       j = INDEX(hunk, d2c(10), i )
  57.     END
  58.     SAY ""
  59.     OPTIONS PROMPT "Press <RETURN> to exit."
  60.     PULL answer
  61.     EXIT
  62.   END
  63. END
  64.  
  65. OPTIONS PROMPT "No CHRS hunk found.  Press <RETURN>"
  66. pull ans
  67. EXIT
  68.